package kr.hkit.androidcomplete02.ch17;

import kr.hkit.androidcomplete02.R;
import kr.hkit.androidcomplete02.ch16.AlertDialogEx;
import kr.hkit.androidcomplete02.ch16.BundleDialogFragment;
import kr.hkit.androidcomplete02.ch16.CheckQuestionFrg;
import kr.hkit.androidcomplete02.ch16.CustomDialog;
import kr.hkit.androidcomplete02.ch16.DialogFragmentEx;
import kr.hkit.androidcomplete02.ch16.DialogTest;
import kr.hkit.androidcomplete02.ch16.DlgQuestionFrg;
import kr.hkit.androidcomplete02.ch16.RadioQuestionFrg;
import kr.hkit.androidcomplete02.ch16.ShowDialogEx;
import kr.hkit.androidcomplete02.ch16.TouchOutside;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class Ch17_AMain extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		getWindow().requestFeature(Window.FEATURE_NO_TITLE);		// 타이틀 바 없애기
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
				this, R.array.chapter17, android.R.layout.simple_list_item_1);

		setListAdapter(adapter);
		
		ApplicationEx app = (ApplicationEx)getApplication();
		Toast.makeText(this, "전역정보" + app.getmMode(), Toast.LENGTH_SHORT).show();
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);

		Intent intent = null;

		switch (position) {

		case 0:
			intent = new Intent(getApplication(), CommActivity.class);
			break;
			
		case 1:
			intent = new Intent(getApplication(), CallOther.class);
			break;
			
		case 2:
			intent = new Intent(getApplication(), Add.class);
			break;
			
		case 3:
			intent = new Intent(getApplication(), ActParent.class);
			break;
			
		case 4:
			intent = new Intent(getApplication(), SaveState.class);
			break;
			
		case 5:
			intent = new Intent(getApplication(), SaveCurve.class);
			break;
			
		case 6:
			intent = new Intent(getApplication(), ApplicationTest.class);
			break;

		}
		startActivity(intent);
	}

}
